<template>
  <div @click="closeDialog" class="mask flex-center" v-if="show">
    <div class="flex-center">
      <div style="position:relative;" class="img-preview-container">
          <!-- <div class="preview-close flex-center" @click="closeDialog">&times;</div> -->
         <img @click.stop="" class="img" :src="url" />
      </div>
     
    </div>
    
  </div>
</template>

<script>
export default {
  name: 'imagePreview',
  props: {
    show: {
      type: Boolean,
      default: false
    },
    url: {
      type: String,
      default: ''
    }
  },
  data() {
    return {}
  },

  methods: {
    closeDialog() {
      this.$emit('update:show', false)
    }
  },
  mounted() {}
}
</script>
<style scoped>
.mask {
  z-index: 1000;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 100vh;
  opacity: 0;
  background-color: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease-in-out 0.3s forwards;
}
.img-preview-container {
  max-width: calc(100vw - 100px);
  max-height: 90vh;
  overflow: auto;
}
.preview-close {
  position: absolute;
  right: -50px;
  top: -50px;
  width: 50px;
  height: 50px;
  font-size: 40px;
  color: #fff;
  cursor: pointer;
  /* transform: translateX(-50%); */
}
.img {
  max-width: 100%;
  height: auto;
  background-color: #fff;
}
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
</style>
